#include <iostream>




using namespace std;
class CallAdapter

{
    public:
virtual void fun1()=0;


};

class Child11;
class Child12;


class Child1:public CallAdapter
{
    public:
virtual void fun1();

};

class Child3:public CallAdapter
{


    public:
virtual void fun1();

};
             
             
             
             
             
class Child2
{

    public:
CallAdapter *_callback;

};


void Child1::fun1()
    
{
cout<<"child fun1"<<endl;

}



    
void Child3::fun1()
{

cout<<"Child3 fun2"<<endl;

}


    



int main()
{


Child2 c2;
CallAdapter *c3=new Child1;
c2._callback=c3;
c2._callback->fun1();
c3=new Child3;
c2._callback=c3; // there  must reAssigned!!!  otherwise still call fun1
c2._callback->fun1();
return 0;

}
